home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1998 July
/
EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso
/
earkit
/
news
/
thor
/
scripts
/
ambbs.ncomm.script
< prev
next >
Wrap
Text File
|
1998-05-24
|
29KB
|
1,295 lines
; $VER: AMBBS.NComm.script 4.2 (4.10.95)
; ABBS/MBBS NComm Script for THOR
; By Eivind Nordseth, Ultima Thule Software
REQUEST OFF
set $dox = ""
set $oldconf = ""
set $gethold = "FALSE"
set $fixtimeout = ""
set $dtmpfile = ""
set $readmode = ""
set $private = ""
set $userinfo = "FALSE"
set $repfile = ""
set $qwkcommand = "Q QWK"
set $qwkcfg = "FALSE"
set $qwkerr = "TRUE"
set $rengrab = ""
set $doctrlx = "FALSE"
set $done = "FALSE"
set $notify = ""
set $packageOK = "FALSE"
set $gotprivfiles = "FALSE"
set $newfilesdate = ""
when "EMSI_REQ" gosub AFrontDetect
cli $THORPath"bin/ScriptServ \""$BBSName"\" WRITECFG EV 0 EV 1 EV 2 EV 3 EV 4 EV 5 EV 6 EV 7 EV 8 EV 10 EV 11 EV 12 EV 13 EV 14"
if exists "t:privupl"$BBSName then cli "delete >nil: \"t:privupl"$BBSName"\""
if exists "t:filenote"$BBSName then cli "delete >nil: \"t:filenote"$BBSName"\""
if exists "t:NoLogOut" then cli "delete >nil: t:NoLogOut"
if exists "t:DoLogOut" then cli "delete >nil: t:DoLogOut"
varfile "t:"$BBSName".CONFIG"
readvar $CfgVer
readvar $BBSID
readvar $BBSType
readvar $Path
readvar $PostConf
readvar $UpLoadDir
readvar $UserName
readvar $UserStreet
readvar $UserAddress
readvar $UserCountry
readvar $UserPhone
readvar $NewFiles
readvar $AutoPDnl
readvar $AutoLogoff
readvar $UseColors
readvar $AnsiMenues
readvar $Bulletins
readvar $ReplyPacket
varfile close
if !$CfgVer == "4" then message "Incompatible version of ScriptServ"
if !$CfgVer == "4" then goto AllDone
if $ReplyPacket == "" then set $ReplyPacket = $BBSID".REP"
cli "delete >nil: \"t:"$BBSName".CONFIG\""
set $LogFile = $Path"ScriptMsg.txt"
when "\r\nNO CARRIER\r\n" goto AllDone
send "^K\n\n"
autoxfer off ; Turn off G&R commands
autoup off ; Turn off Zmodem autoupload
autodown on ; Turn on Zmodem autodownload
if $BBSType == "MBBS" then menuselect TRANSLATE 1 8 ; Use IBN character set
if $BBSType == "MBBS" then set $charset = "IBN" ; Use IBN character set
if $BBSType == "ABBS" then menuselect TRANSLATE 1 0 ; Use ISO character set
if $BBSType == "ABBS" then set $charset = "ISO" ; Use ISO character set
if $BBSType == "MBBS_QWK" then menuselect TRANSLATE 1 8 ; Use IBN character set
if $BBSType == "MBBS_QWK" then set $charset = "IBN" ; Use IBN character set
if $BBSType == "ABBS_QWK" then menuselect TRANSLATE 1 0 ; Use ISO character set
if $BBSType == "ABBS_QWK" then set $charset = "ISO" ; Use IBN character set
converse "FIRST name" $UserName" Q\n"
if $BBSType == "ABBS_QWK" then menuselect TRANSLATE 1 8 ; Use IBN character set
if $BBSType == "ABBS_QWK" then set $charset = "IBN" ; Use IBN character set
converse "will echo):" "\p\n"
dwhen "EMSI_REQ"
capture "t:privupl"$BBSName
when "--more--" send "C"
when "coming online" gosub SysOp
when "The following" set $gotprivfiles = "TRUE"
if $BBSType == "MBBS" then set $docmd = "CHAT N U L 0 MF 50 S IBN\n"
if $BBSType == "ABBS" then set $docmd = "CHAT N U L 0 MF 50 S ISO\n"
if $BBSType == "MBBS_QWK" then set $docmd = "CHAT N U L 0 MF 50 S IBN\n"
if $BBSType == "ABBS_QWK" then set $docmd = "CHAT N U L 0 MF 50 S IBN\n"
gosub DoCommand
;***************** Event loop
wait "Command"
set $doctrlx = "TRUE"
dwhen "The following"
capture off
if !exists "t:"$BBSName".EVENTS" then goto afterEvents
varfile "t:"$BBSName".EVENTS"
eventLoop:
set $done = "FALSE"
readvar $eventnr
readvar $event
if $eventnr == "EOF" then goto evLoopEnd
if $event == "EOF" then goto evLoopEnd
if $event == "0" then gosub EnterMsg
if $event == "1" then gosub ReplyMsg
if $event == "2" then gosub JoinConf
if $event == "3" then gosub ResignConf
if $event == "4" then gosub DownloadFile
if $event == "5" then gosub UploadFile
if $event == "6" then gosub GetConfList
if $event == "7" then gosub ConfigureBBS
if $event == "8" then gosub SendUserInfo
if $event == "10" then gosub GetNewFiles
if $event == "11" then gosub CommandEvent
if $event == "12" then gosub AutoLogOff
if $event == "13" then gosub RetractMsg
if $event == "14" then gosub RetractFile
if $event == "7769" then set $done = "TRUE"
if $done == "TRUE" then cli "run >nil: "$THORPath"bin/ScriptServ \""$BBSName"\" DONE "$eventnr
if !$done == "TRUE" then cli "run >nil: "$THORPath"bin/ScriptServ \""$BBSName"\" ERROR "$eventnr
goto eventLoop
evLoopEnd:
varfile close
cli "delete >nil: \"t:"$BBSName".EVENTS\""
afterEvents:
;***************** Grab messages
set $rengrab = "y"
if $BBSType == "ABBS_QWK" then goto HandleABBSQWK
if $BBSType == "ABBS" then set $docmd = "U GF MBBS\n"
if $BBSType == "ABBS" then gosub DoCommand
set $packageOK = "TRUE"
set $docmd = "R DUMP ALL\n"
gosub DoCommand
when "<0>" goto grabd
converse "Command" "SE Z\n"
grabd:
dlwhen
goto AfterGrabing
;***************** Do ABBS_QWK packet handling
HandleABBSQWK:
set $docmd = "U GF QWK\n"
gosub DoCommand
if !exists $UpLoadDir$ReplyPacket then goto NoABBSRepFile
set $docmd = "Q MU\n"
gosub DoCommand
when "parsed successfully" set $qwkerr = "FALSE"
wait "B01"
upload $UpLoadDir$ReplyPacket,Z
gosub NoTimeout
capture $Path"QWKMsg.txt"
wait "Main Command"
capture off
dlwhen
gosub SetUpTimeout
if $qwkerr == "TRUE" then goto ABBSRepFileFail
set $packageOK = "TRUE"
cli "delete >nil: "$UpLoadDir$ReplyPacket
cli "delete >nil: "$Path"QWKMsg.txt"
set $doctrlx = "TRUE"
goto NoABBSRepFile
ABBSRepFileFail:
set $appendsource = $Path"QWKMsg.txt"
set $appenddest = $LogFile
gosub AppendFile
set $doctrlx = "TRUE"
NoABBSRepFile:
set $docmd = "R DUMP ALL\n"
gosub DoCommand
gosub NoTimeout
when "<0>" goto grabQwkDone
converse "Command" "SE Z\n"
grabQwkDone:
dlwhen
goto AfterGrabing
;***************** Package Done
AfterGrabing:
set $doctrlx = "TRUE"
wait "Command"
if $packageOK == "TRUE" then cli "run >nil: "$THORPath"bin/ScriptServ \""$BBSName"\" PACKAGEDONE"
set $rengrab = "y"
;***************** Capture Newfiles.txt
if !$NewFiles == "y" then goto AfterNewFiles
set $docmd = ""
gosub DoCommand
when "Detailed list (Enter=N):" send "n\n"
cli "Delete >nil: "$Path"Newfiles.txt"
capture $Path"Newfiles.txt"
if $newfilesdate == "" then set $newfilesdate = ";"
send "F N "$newfilesdate" ;\n"
gosub NoTimeout
when "Read Command" goto NewFilesDone
wait "File Command"
NewFilesDone:
dwhen "Read Command"
dwhen "Detailed list (Enter=N):"
capture off
set $doctrlx = "TRUE"
AfterNewFiles:
;***************** Auto dnload private files
if !$AutoPDnl == "y" then goto NoPrivUpl
if !$gotprivfiles == "TRUE" then goto NoPrivUpl
if !exists "t:privupl"$BBSName then goto NoPrivUpl
cli $THORPath"bin/ScriptServ >\"t:privupl"$BBSName".tmp\" \""$BBSName"\" PrivUploadFile \"t:privupl"$BBSName"\""
if !exists "t:privupl"$BBSName".tmp" then goto NoPrivUpl
varfile "t:privupl"$BBSName".tmp"
if !$doctrlx == "TRUE" then wait "Command"
PrivLoop:
readvar $dtmpfile
if $dtmpfile == "" then goto PrivLoopEnd
if $dtmpfile == "EOF" then goto PrivLoopEnd
send "F D "$dtmpfile"\n"
capture "t:filenote"$BBSName
gosub NoTimeout
wait "Command"
if !exists $LogFile then write $LogFile "Messages from script:\n"
write $LogFile " Downloaded private file: "$dtmpfile"\n"
capture off
goto PrivLoop
PrivLoopEnd:
set $doctrlx = "TRUE"
varfile close
cli "delete >nil: \"t:privupl"$BBSName".tmp\""
NoPrivUpl:
;***************** Get files in hold
if exists "t:privupl"$BBSName then cli "delete >nil: \"t:privupl"$BBSName"\""
if !$gethold == "TRUE" then goto NoHold
set $docmd = "F GET\n"
gosub DoCommand
gosub NoTimeout
NoHold:
;***************** Update filenotes of downloaded files.
if !exists "t:filenote"$BBSName then goto NoUpdateNotes
if !$doctrlx == "TRUE" then wait "Command"
set $doctrlx = "TRUE"
cli $THORPath"bin/ScriptServ \""$BBSName"\" UPDATEFILENOTES \"t:filenote"$BBSName"\""
cli "delete >nil: \"t:filenote"$BBSName"\""
NoUpdateNotes:
;***************** Ready for logout
if exists "t:DoLogOut" then goto DoLogOut
if $AutoLogoff == "n" then goto NoLogOut
if exists "t:NoLogOut" then goto NoLogOut
DoLogOut:
set $docmd = "CHAT A U L 30 MF 0\n"
gosub DoCommand
set $docmd = "G Y N Y\n"
gosub DoCommand
when "\r\nNO CARRIER\r\n" goto Hanged
delay 2
repeat
hangup
delay 2
until !CARRIER
Hanged:
dlwhen
goto AllDone
NoLogOut:
set $docmd = "CHAT A U L 30 MF 0 W R\n"
gosub DoCommand
dwhens
timeout 0
AllDone:
request on
end
Hung:
beep
message "\nI think the board has hung."
message "\nTurn off this script within 20 seconds to stop me from logging out !!"
delay 20
beep
message "\nWARNING: Logout in progress.\n"
hangup
goto AllDone
SysOp:
send "Sorry, you are trying to chat with a script.\n"
send "Please put me back to the BBS at once.\n"
set $Timeouts = "0"
wait "SYSOP is going offline!"
set $Timeouts = "0"
return
;************************************************
DoCommand:
if $doctrlx == "TRUE" then send "^X"
converse "Command" $docmd
if !$rengrab == "" then gosub RenameGrab
if !$fixtimeout == "" then gosub SetupTimeout
set $doctrlx = "FALSE"
return
;************************************************
NoTimeout:
set $fixtimeout = "d"
timeout 0
return
SetupTimeout:
set $fixtimeout = ""
set $Timeouts = "0"
timeout 60 gosub SendCTRLX
return
SendCTRLX:
set $fixtimeout = "d"
if $Timeouts == "2" then timeout 20 gosub Hung
if $Timeouts == "2" then send "^X"
if $Timeouts == "1" then send $docmd
if $Timeouts == "1" then set $Timeouts = "2"
if $Timeouts == "0" then send "^X"
if $Timeouts == "0" then set $Timeouts = "1"
return
Hung:
beep
message "\nI think the board has hung."
message "\nTurn off this script within 20 seconds to stop me from logging out !!"
delay 20
beep
message "\nWARNING: Logout in progress.\n"
hangup
goto AllDone
;************************************************
RenameGrab:
set $rengrab = ""
cli $THORPath"bin/ScriptServ \""$BBSName"\" RENAMEGRAB"
cli "run >nil: sys:rexxc/rx 'address THOR.01 RESCAN'"
return
;************************************************
; Enter message subroutine
; Uses variables:
; $conf - conference for message
; $sendto - user message is to (Empty string is equal to ALL)
; $subject - subject of message
; $msgfile - file message is in
; $private - private message (0/!0)
EnterMsg:
readvar $conf
readvar $sendto
readvar $msgfile
readvar $subject
readvar $private
if $private == "" then set $private = "0"
if !$private == "0" then set $private = "y"
if $private == "0" then set $private = "n"
set $done = "TRUE"
when "Private message" send $private"\n"
when "other users (Enter=N)" send "\n"
when "Send message to" send $sendto"\n"
when "enter both the first AND" goto etomyself
when "that name is not registered" goto etomyself
when "ALL is not allowed here!" goto etomyself
when "READ ONLY conference. Us" goto einpost1
when "not a member of this con" goto einpost2
when "Invalid conference selec" goto einpost3
when "Topics are:" goto einpost4
when "Couldn't save msg!" goto einpost5
if $conf == $oldconf then goto InConf
set $docmd = "J "$conf"\n"
gosub DoCommand
if $done == "FALSE" then goto enterRet
set $oldconf = $conf
InConf:
if $sendto == "" then set $sendto = "ALL"
set $docmd = "E\n"
gosub DoCommand
if $done == "FALSE" then goto enterRet
set $dlewhen = "FALSE"
set $dox = ""
gosub SendMessage
if $done == "FALSE" then goto enterRet
enterErr:
if $done == "TRUE" then wait "Command"
set $doctrlx = "TRUE"
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
enterRet:
return
etomyself:
gosub Startlogfile
write $LogFile " Conference "$conf", unable to enter message to "$sendto"\n"
send "^X\n"
set $done = "FALSE"
goto enterErr
einpost5:
gosub Startlogfile
write $LogFile " The BBS couldn't save the message.\n"
set $done = "FALSE"
goto enterErr
einpost4:
gosub Startlogfile
write $LogFile " Invalid conference topic: "$conf"\n"
send "\n"
wait "Command"
set $oldconf = ""
set $done = "FALSE"
goto enterErr
einpost3:
gosub Startlogfile
write $LogFile " Invalid conference selection: "$conf"\n"
set $oldconf = ""
gosub FixJoinErr
wait "Command"
set $done = "FALSE"
goto enterErr
einpost2:
gosub Startlogfile
write $LogFile " User "$sendto" in not a member of conference "$conf"\n"
set $done = "FALSE"
goto enterErr
einpost1:
gosub Startlogfile
write $LogFile " Conference "$conf" is READ ONLY\n"
set $done = "FALSE"
goto enterErr
;************************************************
; Reply message subroutine
; Uses variables:
; $conf - conference for message
; $replyto - reply to message
; $subject - subject of message
; $msgfile - file message is in
; $private - private message (y/n)
; $sendto - user the message is to
ReplyMsg:
readvar $conf
readvar $sendto
readvar $msgfile
readvar $dummy
readvar $subject
readvar $replyto
readvar $private
if $private == "" then set $private = "0"
if !$private == "0" then set $private = "y"
if $private == "0" then set $private = "n"
set $done = "TRUE"
when "Private message" send $private"\n"
when "Include original message" send "n\n"
when "READ ONLY conference you" goto readonlyconf
when "Invalid conference selec" goto invalidconf
when "Topics are:" goto invalidtopic
when "not available for reply." goto notavail
when "Message not found !" goto REnotfound
when "not a member of this con" goto nomember
when "Couldn't save msg!" goto ReSaveErr
if $conf == $oldconf then goto InConf2
set $docmd = "J "$conf"\n"
gosub DoCommand
if $done == "FALSE" then goto replyRet
set $oldconf = $conf
InConf2:
set $docmd = "R RE "$replyto"\n"
gosub DoCommand
if $done == "FALSE" then goto replyRet
set $dox = "^X"
gosub SendMessage
if $done == "FALSE" then goto replyRet
replyErr:
if $done == "TRUE" then wait "Command"
set $doctrlx = "TRUE"
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
replyRet:
return
readonlyconf:
gosub Startlogfile
write $LogFile " Conference "$conf" is READ ONLY, unable to reply message "$replyto"\n"
set $done = "FALSE"
goto replyErr
invalidconf:
gosub Startlogfile
write $LogFile " Invalid conference selection: "$conf", unable to reply message "$replyto"\n"
gosub FixJoinErr
wait "Command"
set $done = "FALSE"
goto replyErr
invalidconf:
gosub Startlogfile
write $LogFile " Invalid conference topic: "$conf", unable to reply message "$replyto"\n"
send "\n"
wait "Command"
set $done = "FALSE"
goto replyErr
nomember:
gosub Startlogfile
write $LogFile " "$sendto" is not member of conference: "$conf", unable to reply message "$replyto"\n"
set $done = "FALSE"
goto replyErr
notavail:
gosub Startlogfile
write $LogFile " Message "$replyto" in "$conf" not available for reply\n"
set $done = "FALSE"
goto replyErr
REnotfound:
gosub Startlogfile
write $LogFile " Message "$replyto" in "$conf" was not found, and was not available for reply\n"
set $done = "FALSE"
goto replyErr
ReSaveErr:
wait "Command"
gosub Startlogfile
write $LogFile " The BBS couldn't save the message.\n"
set $done = "FALSE"
goto replyErr
;************************************************
; Subroutine for sending message
SendMessage:
when "--7-" goto sendit
converse "Subject" $dox$subject"\n"
wait "--7-"
sendit:
dlwhen
if $userinfo == "FALSE" then goto nouserinfo
if $BBSType == "ABBS" then gosub SendABBSClear
if $BBSType == "ABBS_QWK" then gosub SendABBSClear
if $BBSType == "MBBS" then send "^KC"
if $BBSType == "MBBS_QWK" then send "^KC"
nouserinfo:
send "^KZ"
ascsend $Path$msgfile
send "\w^Z^Z"
return
;************************************************
; ABBS clear editor
SendABBSClear:
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
send "^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y"
return
;************************************************
Startlogfile:
if !exists $LogFile then write $LogFile "Messages from script:\n"
write $LogFile "Error in event nr "$eventnr":\n"
return
;************************************************
FixJoinErr:
if $BBSType == "MBBS" then converse "name to join" "\n"
if $BBSType == "MBBS_QWK" then converse "name to join" "\n"
if $BBSType == "ABBS" then send "^K"
if $BBSType == "ABBS" then converse "Join conference:" "\n"
if $BBSType == "ABBS_QWK" then send "^K"
if $BBSType == "ABBS_QWK" then converse "Join conference:" "\n"
return
;************************************************
; Join conference
; Uses variables:
; $conf - conference to join
JoinConf:
readvar $conf
set $done = "TRUE"
when "Invalid conference sele" gosub joinerr
when "Topics are:" gosub topicserr
set $docmd = "J "$conf"\n"
gosub DoCommand
set $oldconf = $conf
wait "Command"
dlwhen
dlwhen
set $doctrlx = "TRUE"
return
joinerr:
gosub Startlogfile
write $LogFile " Invalid conference selection: "$conf", Unable to join\n"
gosub FixJoinErr
set $oldconf = ""
set $done = "FALSE"
return
topicserr:
gosub Startlogfile
write $LogFile " Invalid conference topic: "$conf", Unable to join\n"
send "\n"
set $oldconf = ""
set $done = "FALSE"
return
;************************************************
; Resign conference
; Uses variables:
; $conf - conference to resign
ResignConf:
readvar $conf
when "Invalid conference sele" goto resconferr
when "Topics are:" goto restopicerr
set $done = "TRUE"
set $oldconf = ""
set $docmd = "J "$conf"\n"
gosub DoCommand
if $done == "FALSE" then goto resignRet
set $docmd = "RES Y\n"
gosub DoCommand
if $done == "FALSE" then goto resignRet
resignErr:
dlwhen
dlwhen
wait "Command"
set $doctrlx = "TRUE"
resignRet:
return
resconferr:
gosub Startlogfile
write $LogFile " Invalid conference selection: "$conf", unable to resign\n"
gosub FixJoinErr
set $done = "FALSE"
goto resignErr
restopicerr:
gosub Startlogfile
write $LogFile " Invalid conference topic: "$conf", unable to resign\n"
send "\n"
set $done = "FALSE"
goto resignErr
;************************************************
; Append a file to the en of the other.
; Uses variables:
; $appendsource - File to append.
; $appenddest - Destination.
AppendFile:
if !exists $appenddest then goto afNotExists
cli "join >nil: \""$appenddest"\" \""$appendsource"\" TO \""$appenddest".tmp\""
cli "delete >nil: \""$appenddest"\""
cli "rename >nil: \""$appenddest".tmp\" \""$appenddest"\""
cli "delete >nil: \""$appendsource"\""
return
afNotExists:
cli "rename >nil: \""$appendsource"\" \""$appenddest"\""
return
;************************************************
GetConfList:
set $docmd = ""
gosub DoCommand
set $done = "TRUE"
cli "Delete >nil: "$Path"Conferences.txt"
capture $Path"Conferences.txt"
send "R SH A\n"
wait "Command"
set $doctrlx = "TRUE"
capture off
return
;************************************************
; Download file subroutine
; Uses variables:
; $filename - name of file to download
DownloadFile:
readvar $filename
set $done = "TRUE"
set $fnotfound = "FALSE"
set $fnotaccess = "FALSE"
set $DNnotavail = "FALSE"
set $fexpired = "FALSE"
when "File not found!" set $fnotfound = "TRUE"
when "You are not allowed" set $fnotaccess = "TRUE"
when "not available, please" set $DNnotavail = "TRUE"
when "has expired." set $fexpired = "TRUE"
when "ate files may not be move" set $dfnotmove = "TRUE"
set $gethold = "TRUE"
set $dfnotmove = "FALSE"
set $dtmpfile = $filename
set $docmd = "F ADD "$filename"\n"
gosub DoCommand
capture "t:filenote"$BBSName
wait "Command"
capture off
if $fnotfound == "TRUE" then gosub fnotfound
if $fnotaccess == "TRUE" then gosub fnotaccess
if $DNnotavail == "TRUE" then gosub DNnotavail
if $fexpired == "TRUE" then gosub fexpired
if $dfnotmove == "TRUE" then gosub dferr
gosub FixDnlWhens
set $doctrlx = "TRUE"
return
dferr:
send "F D "$dtmpfile"\n"
capture "t:filenote"$BBSName
gosub NoTimeout
wait "Command"
capture off
return
fnotaccess:
gosub Startlogfile
write $LogFile "Error: Unable to download file \""$dtmpfile"\", you don't have download access\n"
set $done = "FALSE"
return
fnotfound:
gosub Startlogfile
write $LogFile "Error: Unable to download file \""$dtmpfile"\", file not found\n"
set $done = "FALSE"
return
DNnotavail:
gosub Startlogfile
write $LogFile "Error: Unable to download file \""$dtmpfile"\", file not available.\n Please check with sysop.\n"
set $done = "FALSE"
return
fexpired:
gosub Startlogfile
write $LogFile "Error: Unable to download file \""$dtmpfile"\", your file time expired\n"
return
FixDnlWhens:
dwhen "File not found!"
dwhen "You are not allowed"
dwhen "not available, please"
dwhen "ate files may not be move"
dwhen "has expired."
return
;************************************************
; Upload file subroutine
; Uses variables:
; $filename - name of file to upload
; $filedescr - short description of file
; $notify - download notification (y/n)
; $detailed - detailed description for file
; $sendto - private upload to user (empty string/"ALL" = public file)
; $localfile - path/filename to upload.
; $conf - Try to make file private to conf (if $conf != "")
UploadFile:
readvar $filename
readvar $filedescr
readvar $sendto
readvar $conf
if !$BBSType == "MBBS" then goto Upl1
readvar $notify
if $notify == "" then set $notify = "0"
if !$notify == "0" then set $notify = "y"
if $notify == "0" then set $notify = "n"
Upl1:
readvar $detailed
readvar $localfile
set $msgfile = ""
set $done = "TRUE"
if $localfile == "" then set $localfile = $UpLoadDir$filename
if !exists $localfile then goto nofileupload
if $conf == "" then goto AfterUplJoin
when "Invalid conference sele" gosub joinerr
when "Topics are:" gosub topicserr
set $docmd = "J "$conf"\n"
gosub DoCommand
set $oldconf = $conf
wait "Command"
dlwhen
dlwhen
set $doctrlx = "TRUE"
if $done == "FALSE" then goto uplRet
AfterUplJoin:
when "enter both the first AND" goto puperr
when "that name is not registered" goto puperr
when "ALL is not allowed here!" goto puperr
when "Invalid file name!" goto upinvfile
when "File exists already" goto fexists
when "You are not allowed" goto UPnotallowed
when "each download" send $notify"\n"
when "file to be publicly ava" send "\n"
when "Directory name, <?>=lis" send "\n"
if $conf == "" then when "rivate to confer" send "n\n"
if !$conf == "" then when "rivate to confer" send "y\n"
if !$sendto == "" then set $docmd = "F PUP "$sendto"\n"
if $sendto == "ALL" then set $docmd = "F UP\n"
if $sendto == "" then set $docmd = "F UP\n"
gosub DoCommand
if $done == "FALSE" then goto uplRet
converse "ile name" $filename"\n"
converse "ion of file" $filedescr"\n"
wait "B01"
upload $localfile,Z
gosub NoTimeout
when "Command" goto uplfail
if $detailed == "" then goto NoDetailed
converse "description (Enter=Y)" "Y\n"
gosub SetupTimeout
set $msgfile = $detailed
gosub SendMessage
if $done == "FALSE" then goto uplRet
goto uplLateErr
NoDetailed:
converse "description (Enter=Y)" "N\n"
uplLateErr:
dlwhen
uplErr:
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
wait "Command"
set $doctrlx = "TRUE"
uplRet:
return
puperr:
gosub Startlogfile
write $LogFile "Error: Unable to do a private upload of "$filename"\n"
write $LogFile " User "$sendto" is not registered\n"
send "^X\n"
set $done = "FALSE"
goto uplErr
upinvfile:
gosub Startlogfile
write $LogFile "Error: Unable to upload "$filename", filename is invalid\n"
send "^X\n"
set $done = "FALSE"
goto uplErr
fexists:
gosub Startlogfile
write $LogFile "Error: Unable to upload "$filename", file already exists\n"
send "^X\n"
set $done = "FALSE"
goto uplErr
UPnotallowed:
gosub Startlogfile
write $LogFile "Error: Unable to upload "$filename", you don't have download access\n"
set $done = "FALSE"
goto uplErr
uplfail:
gosub Startlogfile
write $LogFile "Error: Unable to upload "$filename", upload failed\n"
set $done = "FALSE"
set $doctrlx = "TRUE"
goto uplLateErr
nofileupload:
gosub Startlogfile
write $LogFile "Error: Unable to upload "$filename", file not found\n"
set $done = "FALSE"
goto uplRet
;************************************************
; Do a custom command
; Uses variables:
; $commandstring - Command to execute.
CommandEvent:
readvar $commandstring
write $LogFile "Executing custom command:\n"
set $docmd = $commandstring"\n"
gosub DoCommand
capture $LogFile
gosub NoTimeout
when "File Command" goto CmdEvDone
when "Main Command" goto CmdEvDone
when "Utility Command" goto CmdEvDone
when "SYSOP Command" goto CmdEvDone
when "SIGOP Command" goto CmdEvDone
when "Misc Command" goto CmdEvDone
when "Mark Command" goto CmdEvDone
when "Read Ref Command" goto CmdEvDone
wait "Read Command"
CmdEvDone:
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
capture off
write $LogFile "\n"
set $done = "TRUE"
set $doctrlx = "TRUE"
set $oldconf = ""
return
;************************************************
; Send user info
; Uses variables:
; $msgfile - file user info is in
SendUserInfo:
readvar $msgfile
when "no resumé user info on this" goto NoUserInfo
set $docmd = "Q EDIT\n"
gosub DoCommand
converse "number displayed (Enter=" "y\n"
set $userinfo = "TRUE"
gosub SendMessage
set $userinfo = "FALSE"
set $done = "TRUE"
uinErr:
wait "Command"
set $doctrlx = "TRUE"
dlwhen
return
NoUserInfo:
gosub Startlogfile
write $LogFile "Error: Sorry, no resumé user info on this system!"
goto uinErr
;************************************************
; Set up BBS configuration
ConfigureBBS:
if $BBSType == "MBBS" then goto SetMBBSMode
if $BBSType == "MBBS_QWK" then goto SetMBBSMode
set $docmd = "R\n"
gosub DoCommand
when "Read Ref Co" set $readmode = "1"
when "Read Co" set $readmode = "2"
wait "Command"
dlwhen
dlwhen
set $doctrlx = "TRUE"
if $readmode == "2" then goto AfterSetMode
set $docmd = "MODE\n"
gosub DoCommand
goto AfterSetMode
SetMBBSMode:
set $qwkcfg = "TRUE"
set $docmd = "R MODE M\n"
gosub DoCommand
AfterSetMode:
set $docmd = "u m y "$AnsiMenues" "$UseColors" y n y\n"
gosub DoCommand
if $BBSType == "ABBS" then gosub SetSpNN
if $BBSType == "ABBS_QWK" then gosub SetSpNN
if $BBSType == "ABBS_QWK" then set $docmd = "gf b "$Bulletins"\n"
if $BBSType == "ABBS_QWK" then gosub DoCommand
set $docmd = "u addr\n"
gosub DoCommand
converse "treet address" "^X"$UserStreet"\n"
converse "code and town" "^X"$UserAddress"\n"
if $UserPhone == "" then set $UserPhone = "-"
converse "ome telephone number" "^X"$UserPhone"\n"
converse "ork telephone number" "\n"
wait "Command"
set $doctrlx = "TRUE"
set $done = "TRUE"
return
SetSpNN:
set $docmd = "sp n n\n"
gosub DoCommand
return
;************************************************
; Set get new files flag.
; Uses variables:
; $newfilesdate - date to use for newfiles.
GetNewFiles:
readvar $newfilesdate
set $NewFiles = "y"
set $done = "TRUE"
return
;************************************************
; Set the autologoff flag.
; Uses variables:
; $boolean - Logoff (y/n)
AutoLogOff:
readvar $boolean
set $AutoLogoff = "y"
if $boolean == "0" then set $AutoLogoff = "n"
set $done = "TRUE"
return
;************************************************
; Retract a message.
; Uses variables:
; $conf - Conference the message is in.
; $reforgnr - Number of message to kill.
RetractMsg:
readvar $conf
readvar $reforgnr
set $docmd = "j "$conf" "$reforgnr" kill\n"
gosub DoCommand
wait "Command"
set $doctrlx = "TRUE"
set $done = "TRUE"
return
;************************************************
; Retract a file
; Uses variables:
; $filename - File name to kill
RetractFile:
readvar $filename
set $docmd = "f ret "$filename " y\n"
gosub DoCommand
wait "Command"
set $doctrlx = "TRUE"
set $done = "TRUE"
return
AFrontDetect:
send "\e\e"
message "\nA nice front door escaped!\n"
return